<template>
    <a-button :size="size" :type="type" @click="download">
        <slot name="icon"></slot>
        <slot></slot>
    </a-button>
</template>

<script lang="ts" setup>
import { CommonHelper } from '@/core/CommonHelper';
import { withDefaults, defineProps } from 'vue';

/**
 * 参数
 */
interface IProps {
    /**
     * 类型
     */
    type?: string;

    /**
     * 大小
     */
    size?: string;

    /**
     * 导出excel表格地址
     */
    url: string;

    /**
     * 导出excel表格携带的请求参数
     */
    datas: any;
}


const props = withDefaults(defineProps<IProps>(), {
    type: "default",
    size: "small",
    url: "",
    datas: {},
})

//下载文件
const download = () => {
    CommonHelper.downloadExcel(props.url, props.datas)
}
</script>

<style scoped>
</style>